home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 July: Mac OS SDK / Dev.CD Jul 96 SDK / Dev.CD Jul 96 SDK1.toast / Development Kits (Disc 1) / MacODBC / ODBC Tools / SampleDriver / PREPARE.C < prev    next >
Encoding:
C/C++ Source or Header  |  1995-03-16  |  3.0 KB  |  171 lines  |  [TEXT/MPS ]

  1.  
  2.     /*
  3.     ** PREPARE.C - This is the module containing the code for SQL for
  4.     ** preparing SQL Commands and other functions prior to execution.
  5.     **
  6.     ** (C) Copyright 1991, 1992 By Microsoft Corp.
  7.     */
  8.  
  9.  
  10. #include <Memory.h>
  11. #include "sample.h"
  12. //#include <dos.h>
  13.  
  14.  
  15.     //  Allocate a SQL statement
  16.  
  17. SQL_PRE_API RETCODE SQL_API
  18. SQLAllocStmt(
  19.     HDBC        hdbc,
  20.     HSTMT  FAR *phstmt)
  21. {
  22.     HSTMT    hstmt;
  23.  
  24. //debugstr( "Sample Driver: SQLAllocStmt" );
  25.     hstmt = (HSTMT)NewHandleClear( sizeof( STMT ) );
  26.     if( hstmt == NULL )
  27.     {
  28.         *phstmt = SQL_NULL_HSTMT;
  29.         return SQL_ERROR;
  30.     }
  31.     HLock( (Handle)hstmt );
  32.     *phstmt = hstmt;
  33.     return SQL_SUCCESS;
  34. }/* end SQLAllocStmt */
  35.  
  36.  
  37. SQL_PRE_API RETCODE SQL_API
  38. SQLFreeStmt(
  39.     HSTMT       hstmt,
  40.     UWORD       fOption)
  41. {
  42.     if (fOption == SQL_DROP )
  43.     {
  44.         HUnlock(      (Handle)hstmt );
  45.         DisposHandle( (Handle)hstmt );
  46.     }
  47.     return SQL_SUCCESS;
  48. }/* end SQLFreeStmt */
  49.  
  50.  
  51.     //  Perform a Prepare on the SQL statement
  52.  
  53. SQL_PRE_API RETCODE SQL_API
  54. SQLPrepare(
  55.     HSTMT       hstmt,
  56.     UCHAR  FAR *szSqlStr,
  57.     SDWORD      cbSqlStr)
  58. {
  59.     return SQL_SUCCESS;
  60. }/* end SQLPrepare */
  61.  
  62.  
  63.     //  Set parameters on a statement handle
  64.  
  65. SQL_PRE_API RETCODE SQL_API
  66. SQLSetParam(        /*    Use SQLBindParameter */
  67.     HSTMT       hstmt,
  68.     UWORD       ipar,
  69.     SWORD       fCType,
  70.     SWORD       fSqlType,
  71.     UDWORD      cbColDef,
  72.     SWORD       ibScale,
  73.     PTR         rgbValue,
  74.     SDWORD FAR *pcbValue)
  75. {
  76.     return SQL_SUCCESS;
  77. }
  78.  
  79.     //    SQLBindParameter
  80.  
  81. SQL_PRE_API RETCODE SQL_API
  82. SQLBindParameter(
  83.     HSTMT       hstmt,
  84.     UWORD        ipar,
  85.     SWORD        fParamType,
  86.     SWORD       fCType,
  87.     SWORD        fSqlType,
  88.     UDWORD      cbColDef,
  89.     SWORD       ibScale,
  90.     PTR         rgbValue,
  91.     SDWORD        cbValueMax,
  92.     SDWORD FAR *pcbValue)
  93. {
  94.     return SQL_SUCCESS;
  95. }
  96.  
  97.     //  Returns the description of a parameter marker.
  98.  
  99. SQL_PRE_API RETCODE SQL_API
  100. SQLDescribeParam(
  101.     HSTMT       hstmt,
  102.     UWORD       ipar,
  103.     SWORD  FAR *pfSqlType,
  104.     UDWORD FAR *pcbColDef,
  105.     SWORD  FAR *pibScale,
  106.     SWORD  FAR *pfNullable)
  107. {
  108.     return SQL_SUCCESS;
  109. }
  110.  
  111.  
  112.     //  Sets multiple values (arrays) for the set of parameter markers.
  113.  
  114. SQL_PRE_API RETCODE SQL_API
  115. SQLParamOptions(
  116.     HSTMT       hstmt,
  117.     UDWORD      crow,
  118.     UDWORD FAR *pirow)
  119. {
  120.     return SQL_SUCCESS;
  121. }
  122.  
  123.  
  124. //  Returns the number of parameter markers.
  125.  
  126. SQL_PRE_API RETCODE SQL_API
  127. SQLNumParams(
  128.     HSTMT       hstmt,
  129.     SWORD  FAR *pcpar)
  130. {
  131.     return SQL_SUCCESS;
  132. }
  133.  
  134.  
  135.     //  Sets options that control the behavior of cursors.
  136.  
  137. SQL_PRE_API RETCODE SQL_API
  138. SQLSetScrollOptions(    /*    Use SQLSetStmtOptions */
  139.     HSTMT       hstmt,
  140.     UWORD       fConcurrency,
  141.     SDWORD      crowKeyset,
  142.     UWORD        crowRowset)
  143. {
  144.     return SQL_SUCCESS;
  145. }
  146.  
  147.  
  148.     //  Set the cursor name on a statement handle
  149.  
  150. SQL_PRE_API RETCODE SQL_API
  151. SQLSetCursorName(
  152.     HSTMT       hstmt,
  153.     UCHAR  FAR *szCursor,
  154.     SWORD       cbCursor)
  155. {
  156.     return SQL_SUCCESS;
  157. }
  158.  
  159.  
  160.     //  Return the cursor name for a statement handle
  161.  
  162. SQL_PRE_API RETCODE SQL_API
  163. SQLGetCursorName(
  164.     HSTMT       hstmt,
  165.     UCHAR  FAR *szCursor,
  166.     SWORD       cbCursorMax,
  167.     SWORD  FAR *pcbCursor)
  168. {
  169.     return SQL_SUCCESS;
  170. }/* end SQLGetCursorName */
  171.